package leetcode.code1805;

import java.util.HashSet;
import java.util.Set;

public class Solution3 {

	int mod = (int) 1e9 + 7;

	public int numDifferentIntegers(String word) {
		Set<Integer> set = new HashSet<>();
		Integer num = null;
		for (int i = 0; i <= word.length(); i++) {
			char c = i < word.length() ? word.charAt(i) : 'a';
			if (c >= '0' && c <= '9') {
				if (num == null) {
					num = c - '0';
				} else
					num = num * 10 + c - '0';
				num %= mod;
			} else if (num != null) {
				set.add(num);
				num = null;
			}
		}
		return set.size();
	}

	public static void main(String[] args) {
		Solution3 so = new Solution3();
		so.numDifferentIntegers("a1b01c001");
	}
}
